package com.example.weli.ble2test;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class TCP_linkActivity extends Activity {
    public static String EXTRA_TCP_ADDRESS = "tcp_address";
    public static String EXTRA_TCP_PORT = "tcp_port";

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(5);
        setContentView(R.layout.tcp_link);
        setResult(0);
        ((EditText) findViewById(R.id.editTcp_add)).setText("192.168.1.100");
        ((EditText) findViewById(R.id.editTcp_po)).setText("8080");
        ((Button) findViewById(R.id.butcontcp)).setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.putExtra(TCP_linkActivity.EXTRA_TCP_ADDRESS, ((EditText) TCP_linkActivity.this.findViewById(R.id.editTcp_add)).getText().toString());
                intent.putExtra(TCP_linkActivity.EXTRA_TCP_PORT, ((EditText) TCP_linkActivity.this.findViewById(R.id.editTcp_po)).getText().toString());
                TCP_linkActivity.this.setResult(-1, intent);
                TCP_linkActivity.this.finish();
            }
        });
        ((Button) findViewById(R.id.tcpbrack)).setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                TCP_linkActivity.this.finish();
            }
        });
    }
}
